<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/10/13
 * Time: 22:07
 */
namespace app\model;


use think\facade\Db;
use think\Model;

class UserOrg extends Model
{

    public function addOneUserOrg($data){
        $data['uo_create_time'] = time();
        return Db::table('user_org')->insertGetId($data);
    }


    public function getInfoByUid($uid,$field = '*')
    {
        return Db::table('user_org')->where(['uo_uid'=>$uid,'uo_status'=>1])->field($field)->find();
    }
    public function delOrgInfoByUid($uid){
        $where = [
            'uo_uid' => $uid,
            'uo_status' => 1
        ];

        $update = [
            'uo_status' => 0,
            'uo_update_time' => time()
        ];
        return Db::table('user_org')->where($where)->update($update);
    }
}